<%@ page language="java" import="java.util.*,java.sql.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>管理员</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<style type="text/css">
		li{
		  list-style-type:<%out.print("none;");%>
		}
	</style>

  </head>
  
  <body>
    <%
       String login=(String) session.getAttribute("login");
       if(login==null){
          response.sendRedirect("index.jsp");
          return;
       }
     %>
     您好，欢迎进入本页面，需要查询的成绩如下表！
     <%
    try{
    	Class.forName("com.mysql.jdbc.Driver");
    	Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","user","123");
    	Statement st=con.createStatement();
    	String sql="select s.sname,st.subjectname,r.score from examresult r inner join student s on (s.stuno=r.st_id) inner join subject st on (st.id=r.sb_id)";
    	ResultSet rs=st.executeQuery(sql);
    	while(rs.next()){
    		//out.println(rs.getInt("id")+"\n"+rs.getString("score")+"\n"); 
   %>
    		<li><%=rs.getString("s.sname") %>,<%=rs.getString("st.subjectname")%>,<%=rs.getInt("r.score")%></li> 
     <%
    	}
    	}catch(Exception e){
    	e.printStackTrace(); 
    	}
     %>
  </body>
</html>
